"use strict";
cc._RF.push(module, '070c6nki85PIrzb64UYRNUT', 'UIGame');
// script/ui/UIGame.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var CameraManager_1 = require("../game/CameraManager");
var GameManager_1 = require("../game/GameManager");
var Constants_1 = require("../libs/Constants");
var GameData_1 = require("../libs/GameData");
var HelperMgr_1 = require("../libs/HelperMgr");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var UIGame = /** @class */ (function (_super) {
    __extends(UIGame, _super);
    function UIGame() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.model = null;
        _this.score = null;
        _this.gold = null;
        _this.chance = null;
        _this.time = null;
        _this.mask = null;
        return _this;
    }
    // onLoad () {}
    UIGame.prototype.start = function () {
        this.model.string = GameData_1.default.instance.gameModel ? "第" + GameData_1.default.instance.gameStage + "关" : "畅意模式";
        this.chance.node.parent.active = GameData_1.default.instance.gameModel;
        this.time.node.parent.active = !GameData_1.default.instance.gameModel;
    };
    UIGame.prototype.update = function (dt) {
        if (GameManager_1.default.instace.gameIsStart && !GameManager_1.default.instace.gameIsOver) {
            this.mask.active = CameraManager_1.default.instance.isFollowing;
            this.gold.string = GameData_1.default.instance.playGold.toString();
            this.score.string = GameManager_1.default.instace.gameScore.toString();
            this.chance.string = GameManager_1.default.instace.gameChance.toString();
            this.time.string = GameManager_1.default.instace.gameTime > 0 ? GameManager_1.default.instace.gameTime.toString() : "0";
        }
    };
    UIGame.prototype.onRank = function () {
        HelperMgr_1.default.showUI(Constants_1.default.UIName.UIRank);
    };
    UIGame.prototype.onTool = function () {
        if (GameManager_1.default.instace.playerIsStosh) {
            GameManager_1.default.instace.playerIsStosh = false;
            return;
        }
        if (GameData_1.default.instance.playStoshs[GameData_1.default.instance.playStosh - 1] > 0) {
            GameManager_1.default.instace.playerIsStosh = true;
        }
        else {
            HelperMgr_1.default.showUI(Constants_1.default.UIName.UIShop);
        }
    };
    UIGame.prototype.onBack = function () {
        GameManager_1.default.instace.backMain();
    };
    __decorate([
        property(cc.Label)
    ], UIGame.prototype, "model", void 0);
    __decorate([
        property(cc.Label)
    ], UIGame.prototype, "score", void 0);
    __decorate([
        property(cc.Label)
    ], UIGame.prototype, "gold", void 0);
    __decorate([
        property(cc.Label)
    ], UIGame.prototype, "chance", void 0);
    __decorate([
        property(cc.Label)
    ], UIGame.prototype, "time", void 0);
    __decorate([
        property(cc.Node)
    ], UIGame.prototype, "mask", void 0);
    UIGame = __decorate([
        ccclass
    ], UIGame);
    return UIGame;
}(cc.Component));
exports.default = UIGame;

cc._RF.pop();